<template>
  <header class="bg-fff">
    <form class="w100p">
      <van-search
        v-model="value"
        show-action
        placeholder="请输入搜索关键词"
        @search="onSearch"
        @cancel="onCancel"
      />
    </form>
  </header>

  <ul style="margin-top: 60px" class="pl-10 pr-10 list">
    <li
      @click="toDetail(item)"
      class="item bg-fff mb-10"
      v-for="item in articleList"
    >
      <h3><van-text-ellipsis :content="item.title" /></h3>
      <div class="content">
        <van-text-ellipsis
          rows="2"
          :content="item.title"
          expand-text="展开"
          collapse-text="收起"
        />
      </div>
    </li>
  </ul>
</template>
<script setup>
import articleList from "../api/data";
import { ref } from "vue";
import { useStore } from "../pinia";
import { useRouter } from "vue-router";

const router = useRouter();
const store = useStore();
const onSearch = () => {};
const onCancel = () => {};
const toDetail = (item) => {
  store.$patch((state) => {
    state.currArticle = item;
    state.activeIndex = 1;
    router.push("/biji");
  });
};
</script>

<style scoped>
#app {
  background-color: #f4f4f4;
}
.list .item {
  border-radius: 10px;
  /* height: 80px; */
  padding: 10px;
}
</style>
